package com.example.gokuplayalong.bases.custom.textwatcher;

import java.util.regex.Pattern;

public class RegExUtil {
    private static String PHONE_REGEX = "(?:(?:1))(?:(?:3[0-9]{1})|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8)|(?:9[189]))[0-9]{8}";
    private static String CHAT_MESSAGE_REGEX = "";
    private static String CARD_NO_REGEX = "^(\\d{6})(\\d{4})(\\d{2})(\\d{2})(\\d{3})([0-9]|X)$";
    private static String DEFAULT_REGEX = "[^\\u4E00-\\u9FA50-9a-zA-Z,，.。！!?？@\n]";

    public static Boolean isPhoneNumber(String value) {
        return Pattern.matches(PHONE_REGEX, value);
    }

    public static Boolean isChatMessage(String value) {
        return Pattern.matches(CHAT_MESSAGE_REGEX, value);
    }

    public static String regexString(String string) {
        return string.replaceAll(DEFAULT_REGEX, "");
    }


    public static Boolean isCardNo(String value) {
        return Pattern.matches(CARD_NO_REGEX, value);
    }

}
